package main;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;


public class LireEcrire {
	private String inputFile;
	private String outputFile;
	private BufferedReader brInput;
	private BufferedWriter brOutput;
	
	
	public  LireEcrire(String inputFile, String outputFile){
		this.inputFile=inputFile;
		this.outputFile=outputFile;
		try{
		this.brInput = new BufferedReader(new FileReader(this.inputFile));
	    this.brOutput = new BufferedWriter(new FileWriter(this.outputFile));
		}
		catch (Exception e){
		      System.err.println("Error: " + e.getMessage());
		    }
	}
	
	public String lire(){
		String lec = null;
		try{
		lec = this.brInput.readLine();
		}
		catch (Exception e){
		      System.err.println("Error: " + e.getMessage());
		    }
		return lec;
	}
	
	public void ecrire(String ligne){
		try{
		this.brOutput.write(ligne);
		this.brOutput.newLine();
		}
		catch (Exception e){
		      System.err.println("Error: " + e.getMessage());
		    }
	}
	
	public void finir(){
		try{
		this.brOutput.close();
		}
		catch (Exception e){
		      System.err.println("Error: " + e.getMessage());
		    }
	}
	
	

}
